# app/user/models/user_role.py
from datetime import datetime, timezone

from sqlmodel import Field, SQLModel


class UserRole(SQLModel, table=True):
    __tablename__ = "user_role"
    id: int = Field(primary_key=True)
    user_id: int = Field(foreign_key="user.id")
    role_id: int = Field(foreign_key="role.id")
    assigned_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
